package yur.wedding.modules.sys.service.impl;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import yur.wedding.common.utils.Query;

import yur.wedding.modules.sys.dao.SysLogDao;
import yur.wedding.modules.sys.entity.SysLogEntity;
import yur.wedding.modules.sys.service.SysLogService;
import yur.wedding.utils.PageUtils;


@Service("sysLogService")
public class SysLogServiceImpl extends ServiceImpl<SysLogDao, SysLogEntity> implements SysLogService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String username= (String) params.get("username");
        String operation= (String) params.get("operation");
        String state= (String) params.get("state");
        System.out.println("日志模糊查询参数 username:"+username+"===operation:"+operation+"====state:"+state);
        QueryWrapper<SysLogEntity> wrapper = new QueryWrapper<>();
        if (state.equals("S")){

            wrapper .like("username", username)
                    .and(i -> i.like("operation", operation));
        }
        IPage<SysLogEntity> page = this.page(
                new Query<SysLogEntity>().getPage(params),wrapper
        );

        return new PageUtils(page);
    }

}
